<?php

namespace App\Http\Controllers;

use App\Exceptions\Exceptions\ValidationException;
use App\Http\Utils\Response;
use Illuminate\Http\Request;
use Laravel\Lumen\Routing\Controller as BaseController;


class Controller extends BaseController
{
    /**
     * {@inheritdoc}
     */
    protected function throwValidationException(Request $request, $validator)
    {
        throw new ValidationException($validator->errors()->all());
    }

    /**
     * @param mixed $data
     * @param int $code
     * @param string $msg
     * @param string $type
     * @param mixed $info
     * @return Response
     */
    public function json($data, $code = 200, $msg = 'ok', $type = null, $info = null)
    {
        return new Response($data, $msg, $code, $type, $info);
    }
}
